home *** CD-ROM | disk | FTP | other *** search
- /* AudInPut21APR94A - auditory input via Clip List for Mind.rexx AI. */
- ht = 1 /* 1APR1994: A "heeltap" variable during handshake. */
- LF = 'A'x
- quitline = "To terminate Mind.rexx session, press <ESCAPE> key." 'A'x
- rd = 0 /* 2APR1994: A counter to escape from waiting for "READY." */
- revline = "To review auditory memory, press <BACK SPACE> key." 'A'x
- thinkline = "To let Mind.rexx think, press <TAB> key." 'A'x
- CALL Open(raw_window,'RAW:0/0/640/70/',
- 'Enter natural language word, followed by a non-letter. (<DEL> to quit.)')
- prelimline = "Synch =" GETCLIP('synch')"; control = "GETCLIP('control')";",
- "response = "GETCLIP('response')"; message =" GETCLIP('message') 'A'x
- prelimput = CALL Writech(raw_window, prelimline)
-
- DO FOREVER
- rd = 0
- DO WHILE GETCLIP('response') = "WAIT"
- waitline = "AI response is set to " || GETCLIP('response') ||"."||'D'x
- waitmess = CALL Writech(raw_window, waitline)
- END
- linefeed = CALL Writech(raw_window, LF)
- /* First AudInPut waits for a "READY" response from Mind.rexx. */
- audput = Readch(raw_window,1)
- IF audput = '1B'x THEN SETCLIP('control', "QUIT") /* Immediate "QUIT". */
- DO UNTIL GETCLIP('response') = "READY" /* 13APR1994. */
- respline = "response = " || GETCLIP('response') || 'D'x
- stall = CALL Writech(raw_window, respline)
- IF GETCLIP('control') = "RESET" THEN EXIT /* 13APR1994: An escape. */
- END /* 13APR1994. */
- IF GETCLIP('response') = "READY" THEN SETCLIP('message', audput)
- banner = "Synch =" GETCLIP('synch')"; control = "GETCLIP('control')";",
- "response = "GETCLIP('response')"; message =" GETCLIP('message') 'A'x
- status = CALL Writech(raw_window, banner)
- thinkopt = CALL Writech(raw_window, thinkline) /* 4APR1994. */
- IF audput = '9'x THEN SETCLIP('control', "COGITATE") /* TAB key. */
- revopt = CALL Writech(raw_window, revline)
- IF audput = '8'x THEN SETCLIP('control', "REVIEW")
- quitopt = CALL Writech(raw_window, quitline)
- IF audput = '1B'x THEN SETCLIP('control', "QUIT") /* ESC = QUIT. */
- IF audput = '1B'x THEN audput = "" /* Reset to nothing after "QUIT". */
- IF audput = '7F'x THEN EXIT /* Hit "DEL" to exit. */
- IF audput < '41'x THEN audmem.t = '20'x
- IF audput > '7A'x THEN audmem.t = '20'x
- inchar = audmem.t
- LF = 'A'x
- feedline = CALL Writech(raw_window, LF)
- DO UNTIL GETCLIP('response') = "WAIT"
- /* AudInPut waits to be told to wait by Mind.rexx. */
- heeltap = "Character" audput "sent;" GETCLIP('response') ht "cycle(s)." 'D'x
- tapping = CALL Writech(raw_window, heeltap)
- ht = ht + 1
- IF ht = 1000 THEN LEAVE /* Safety measure. */
- END
- ht = 1 /* Reset ht to this minimal value. */
- feedline = CALL Writech(raw_window, LF)
- audput = "" /* 2APR1994: A reset for safety. */
- END
- /* The Clip List has four items in it: */
- /* - control (commands to be issued to Mind.rexx); */
- /* - synch (timing to be set by either Mind.rexx or AudInPut); */
- /* - message (passed from AudInPut to Mind.rexx); */
- /* - response ( WAIT/READY from Mind.rexx to AudInPut). */
- /* Mind.rexx tends to slow down as its memory gets filled, so we */
- /* assume that the AudInPut program should use a "DO UNTIL" loop to */
- /* wait for Mind.rexx to send a "READY" response via the Clip List. */
-